<!DOCTYPE html>
<html>
<head>
    <title>Physics Diagram Fig. 4.10</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }
        canvas {
            border: 1px solid #ccc;
            background-color: #fff;
        }
    </style>
</head>
<body>
    <canvas id="physicsCanvas" width="600" height="350"></canvas>
    <script>
        const canvas = document.getElementById('physicsCanvas');
        const ctx = canvas.getContext('2d');

        // Style settings
        ctx.strokeStyle = 'black';
        ctx.fillStyle = 'black';
        ctx.lineWidth = 2;
        ctx.font = '22px "Courier New", monospace';
        ctx.textAlign = 'center';

        // --- Main Drawing ---

        // 1. Outer rectangle
        ctx.strokeRect(20, 20, 560, 220);

        // 2. Inner rectangle (Hydrogen target)
        ctx.strokeRect(100, 110, 380, 50);

        // 3. Neutron beam line (n -> C)
        ctx.beginPath();
        // Line
        ctx.moveTo(70, 135);
        ctx.lineTo(510, 135);
        // Arrowhead
        ctx.moveTo(500, 130);
        ctx.lineTo(510, 135);
        ctx.lineTo(500, 140);
        ctx.stroke();

        // Detector symbol (C)
        ctx.beginPath();
        // T-bar
        ctx.moveTo(525, 125);
        ctx.lineTo(525, 145);
        ctx.stroke();
        // Label 'C'
        ctx.fillText('C', 525, 120);

        // Label 'n'
        ctx.fillText('n', 60, 142);


        // 4. Dimension line ("1 metre")
        ctx.beginPath();
        // Left T-bar
        ctx.moveTo(140, 60);
        ctx.lineTo(140, 80);
        // Right T-bar
        ctx.moveTo(440, 60);
        ctx.lineTo(440, 80);
        // Horizontal line with arrows
        ctx.moveTo(140, 70);
        ctx.lineTo(440, 70);
        // Left arrowhead
        ctx.moveTo(150, 65);
        ctx.lineTo(140, 70);
        ctx.lineTo(150, 75);
        // Right arrowhead
        ctx.moveTo(430, 65);
        ctx.lineTo(440, 70);
        ctx.lineTo(430, 75);
        ctx.stroke();

        // Text "1 metre"
        ctx.fillText('1 metre', 290, 65);


        // 5. Figure caption
        ctx.font = '20px "Times New Roman", serif';
        ctx.fillText('Fig. 4.10', 300, 300);

    </script>
</body>
</html>